In [1]:
from importlib import reload
In [2]:
sys.path.append(os.path.join(os.path.abspath('../..'), 'src'))
sys.path.append(os.path.join(os.path.abspath('../..'), 'data'))
In [58]:
import utils
import bill_proc_utils
import bill_sponsor_analysis_pipeline
import build_repr_report_pages
In [79]:
reload(bill_proc_utils)
reload(bill_sponsor_analysis_pipeline)
reload(build_repr_report_pages)
Out[79]:
In [17]:
main_repo_dir = utils.get_main_dir()
In [18]:
reprs_info, bill_info, sponsor_info = bill_sponsor_analysis_pipeline.main('2014')
In [90]:
reprs_info['LinkApend'] = reprs_info.apply(lambda x: str(x.Session) + '_' + str(x.name), axis=1)
In [91]:
reprs_info.head()
Out[91]:
In [20]:
bill_info.head()
Out[20]:
In [22]:
sponsor_info.head()
Out[22]:
In [36]:
# These are our lookup tables
reprs_bills = sponsor_info.groupby('SponsorID')
bills_reprs = sponsor_info.groupby('BillID')
In [37]:
s_ixs = list(reprs_info.index)
s_ixs[:10]
Out[37]:
In [38]:
repr_id = s_ixs[0]
In [52]:
repr_bills = list(reprs_bills.get_group(repr_id)['BillID'])
repr_bills[:5]
Out[52]:
In [54]:
sub_bi = build_repr_report_pages.get_repr_bi(bill_info, repr_bills)
In [55]:
sub_bi.head()
Out[55]:
In [56]:
repr_cosponsors = build_repr_report_pages.build_cos_df(repr_bills, repr_id,
reprs_info,
reprs_bills, bills_reprs)
In [57]:
repr_cosponsors.head()
Out[57]:
In [72]:
repr_keywords = bill_proc_utils.build_keywords_df(sub_bi, cutoff=5)
In [73]:
repr_keywords.shape
Out[73]:
In [74]:
repr_keywords.head()
Out[74]:
In [80]:
repr_data = build_repr_report_pages.get_repr_data(repr_id, bill_info, reprs_info, reprs_bills, bills_reprs)
In [81]:
repr_data.keys()
Out[81]:
In [82]:
repr_data['BillKeywords'].head()
Out[82]:
In [83]:
repr_data['Cosponsors'].head()
Out[83]:
In [86]:
cols = ['Session', 'Chamber', 'Bill', 'Title']
repr_data['Bills'][cols].head()
Out[86]:
In [ ]: